libname motind2R 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R';

libname ind2R 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\independents\ind2R';
libname dem2R 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\democrats\dem2R';
libname rep2R 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\republicans\rep2R';

data motind2R.all; set ind2R.all dem2R.all rep2R.all; run;

proc freq data=motind2R.all; table partyid forcedparty; run;
proc freq data=ind2R.all; table partyid forcedparty; run;
proc freq data=dem2R.all; table partyid forcedparty; run;
proc freq data=rep2R.all; table partyid forcedparty; run;


**********************************CLEANING DATA**************************************;

*coding edu as continuous;
data motind2R.all; set motind2R.all;
format education 1.;
if edu = 1 then education = 1; *elementary school;
else if edu = 2 then education = 2; *junior high;
else if edu = 3 then education = 3; *some high school;
else if edu = 4 then education = 4; *high school graduate;
else if edu in (5,6) then education = 5; *some college and associate's degree;
else if edu = 7 then education = 6; *bachelor's degree;
else if edu in (8,9,14) then education = 7; *some graduate school, master's degree, MBA;
else if edu in (10,11,13) then education = 8; *JD, MD, other advanced degree;
else if edu = 12 then education = 9; run; *PhD;

proc freq data=motind2R.all; table citizen; run;

*getting rid of non-US citizens - asked for this, but didn't get it;
data motind2R.all; set motind2R.all; 
if citizen NE "us" then delete; run;
*59 subjects deleted;

TITLE 'Completers vs Noncompleters';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Completers vs Noncompleters.html';
data motind2R.all; set motind2R.all; 
if consented = . then delete; 
if debriefed = . then debriefed = 0; run;
proc ttest data=motind2R.all; class debriefed; var age edu; run;
proc freq data=motind2R.all; 
tables gender*debriefed  / chisq ; run;

ODS HTML CLOSE;
*78 deleted for not consenting;

*getting rid of people who did not complete the 2 main DVs;
data motind2R.all; set motind2R.all; 
if planiat = . then delete; 
if planprefer = . then delete; run;
*551 subjects deleted;

*recoding variables;
data motind2R.all; set motind2R.all; 
socialpolitics = .;
if socpolitics = 1 then socialpolitics = 3; 
else if socpolitics = 2 then socialpolitics = 2; 
else if socpolitics = 3 then socialpolitics = 1; 
else if socpolitics = 4 then socialpolitics = 0; 
else if socpolitics = 5 then socialpolitics = -1; 
else if socpolitics = 6 then socialpolitics = -2; 
else if socpolitics = 7 then socialpolitics = -3; run;

data motind2R.all; set motind2R.all; 
economicpolitics = .;
if econpolitics = 1 then economicpolitics = 3; 
else if econpolitics = 2 then economicpolitics = 2; 
else if econpolitics = 3 then economicpolitics = 1; 
else if econpolitics = 4 then economicpolitics = 0; 
else if econpolitics = 5 then economicpolitics = -1; 
else if econpolitics = 6 then economicpolitics = -2; 
else if econpolitics = 7 then economicpolitics = -3; run;

data motind2R.all; set motind2R.all; 
partyforce = .;
if forcedparty = 1 then partyforce = -3; 
else if forcedparty = 2 then partyforce = -2; 
else if forcedparty = 3 then partyforce = -1; 
else if forcedparty = 4 then partyforce = 0; 
else if forcedparty = 5 then partyforce = 1; 
else if forcedparty = 6 then partyforce = 2; 
else if forcedparty = 7 then partyforce = 3; run;

data motind2R.all; set motind2R.all; 
informat majorparty $3.;
majorparty = "."; 
if partyid = 1 then majorparty = "Dem"; 
else if partyid = 2 then majorparty = "Rep"; 
else if partyid = 3 then majorparty = "Ind"; run;

data motind2R.all; set motind2R.all; 
informat indforce $9.;
indforce = "."; 
if partyforce in (1,2,3) then indforce = "DemInd"; 
else if partyforce = 0 then indforce = "StrongInd"; 
else if partyforce in (-1,-2,-3) then indforce = "RepInd"; run;

data motind2R.all; set motind2R.all; 
detailsinfluenced = howdetails; run;

data motind2R.all; set motind2R.all; 
prefermain = .;
if planprefer = 1 then prefermain = -3; 
else if planprefer = 2 then prefermain = -2; 
else if planprefer = 3 then prefermain = -1; 
else if planprefer = 4 then prefermain = 0; 
else if planprefer = 5 then prefermain = 1; 
else if planprefer = 6 then prefermain = 2; 
else if planprefer = 7 then prefermain = 3; run;

proc means data=motind2R.all; var prefermain planprefer; run;
proc corr data=motind2R.all; var prefermain planprefer; run;

data motind2R.all; set motind2R.all; 
poliat = 0 - politicsiat; run;

data motind2R.all; set motind2R.all; 
informat poliatbin $19.;
poliatbin = "."; 
if poliat > .15 then poliatbin = "Implicit Democrat";
else if poliat < -.15 then poliatbin = "Implicit Republican"; run;

data motind2R.all; set motind2R.all; 
conditionnum = .; 
if condition = "dem" then conditionnum = .5; 
else if condition = "rep" then conditionnum = -.5; run;

data motind2R.all; set motind2R.all; 
if partyinfluenced = 1 then aware = -.5; 
else if partyinfluenced in (2,3,4,5) then aware = .5; run;

proc contents data=motind2R.all; run;
proc means data=motind2R.all; run;


************************************************************************
CLEAN DATASET INCLUDES XXX who:
only us citizens 
only people who completed both 2 DVs 

RETAINED PEOPLE who:
failed the IMC
************************************************************************;

**********************************Sample Characteristics**************************************;

TITLE 'Combined Sample Characteristics';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Combined Sample Characteristics.html';

proc freq data=motind2R.all;
tables gender racecen ethniccen citizen partyid; run;

proc univariate data=motind2R.all; var education edu; run;
proc freq data=motind2R.all; table education edu; run;

proc means data=motind2R.all; 
var relID socialpolitics economicpolitics poliat age; run;

proc sort data=motind2R.all; by majorparty;

proc freq data=motind2R.all; by majorparty; 
tables gender racecen ethniccen citizen partyid edu; run;

proc means data=motind2R.all; by majorparty;
var relID socialpolitics economicpolitics poliat age; run;

ODS HTML CLOSE;



*************************making new datasets to analyze data easily*********************;
data motind2R.ind; set motind2R.all; 
keep = 0; 
if majorparty = "Ind" then keep = 1; 
if keep = 0 then delete; run;

data motind2R.strong; set motind2R.ind; 
keep = 0; 
if partyforce = 0 then keep = 1; 
if keep = 0 then delete; run;

data motind2R.rep; set motind2R.all; 
keep = 0; 
if majorparty = "Rep" then keep = 1; 
if keep = 0 then delete; run;

data motind2R.dem; set motind2R.all; 
keep = 0; 
if majorparty = "Dem" then keep = 1; 
if keep = 0 then delete; run;



**************analysis with manipulation check failures removed on different datasets****************;

TITLE 'Main Analysis with Study Manip Check Failures Removed';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Main Analysis with Study Manip Check Failures Removed.html';

data motind2R.manip; set motind2R.all; run;

data motind2R.manip; set motind2R.manip; 
if condition = "rep" AND manip1 = 2 then delete; run;  *129;

data motind2R.manip; set motind2R.manip; 
if condition = "dem" AND manip1 = 1 then delete; run; *132;

data motind2R.manip; set motind2R.manip; 
if condition = "rep" AND manip2 = 1 then delete; run;  *129;

data motind2R.manip; set motind2R.manip; 
if condition = "dem" AND manip2 = 2 then delete; run; *132;

data motind2R.manip; set motind2R.manip; 
if manip3 = 1 then delete; run; *65;

proc sort data=motind2R.manip; by majorparty; 

proc ttest data=motind2R.manip; by majorparty; 
class condition; var prefermain planiat; run;

proc glm data=motind2R.manip (where=(majorparty="Ind")); 
class condition;
model prefermain=condition|poliat; run;

proc glm data=motind2R.manip (where=(majorparty="Ind")); 
class condition;
model planiat=condition|poliat; run;

proc glm data=motind2R.manip (where=(indforce="StrongInd")); 
class condition;
model prefermain=condition|poliat; run;

proc glm data=motind2R.manip (where=(indforce="StrongInd")); 
class condition;
model planiat=condition|poliat; run;

proc sort data=motind2R.manip; by majorparty; 

proc means data=motind2R.manip ; by majorparty; 
class poliatbin condition; 
var planiat prefermain; run;

ODS HTML CLOSE;


*************manipulation checks****************;

TITLE 'Manip Checks';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Manip Checks.html';

proc freq data=motind2R.all; tables IMC; run;

proc sort data=motind2R.all; by condition;
proc freq data=motind2R.all; by condition;
tables manip1 manip2 manip3; run; 

proc sort data=motind2R.all; by IMC condition;
proc freq data=motind2R.all; by IMC condition;
tables manip1 manip2 manip3; run;

ODS HTML CLOSE;



**********************************ANALYZING DATA**************************************;

TITLE 'Combined Sample Analysis';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Combined Analysis.html';

proc means n mean std data=motind2R.all; 
var prefermain planiat priorpref; run;

proc means n mean std data=motind2R.all (where=(majorparty NE ".")); class majorparty;
var prefermain planiat priorpref; run;

proc sort data=motind2R.all; by majorparty; 
proc corr data=motind2R.all;  by majorparty; var planiat prefermain; run;

proc means n mean std data=motind2R.all;
var partyinfluenced socialinfluenced detailsinfluenced ; run;

proc means n mean std data=motind2R.all (where=(majorparty NE ".")); class majorparty;
var partyinfluenced socialinfluenced detailsinfluenced ; run;

proc sort data=motind2R.all; by majorparty;

proc freq data=motind2R.all (where=(majorparty NE ".")); by majorparty;
tables partyinfluenced detailsinfluenced; run;

proc corr data=motind2R.all; 
var planiat prefermain socialpolitics poliat economicpolitics politics; run;

*testing hypotheses on reasoning;
proc glm data=motind2R.all (where=(majorparty NE ".")); class majorparty; 
model partyinfluenced=majorparty; means majorparty / tukey; run;

ODS HTML CLOSE;


**********************************DEMOCRATS**************************************;

TITLE 'Democrats Analysis';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Democrats Analysis.html';

*test of hypothesis;
proc ttest data=motind2R.dem ; 
class condition; var prefermain planiat; run;

*covarying DV order;
proc glm data=motind2R.dem ; class condition dvorder;
model prefermain=condition|dvorder; run;

proc glm data=motind2R.dem ; class condition dvorder;
model planiat=condition|dvorder; run;

ODS HTML CLOSE;

**********************************REPUBLICANS**************************************;

TITLE 'Republicans Analysis';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Republicans Analysis.html';

*test of hypothesis;
proc ttest data=motind2R.rep ; 
class condition; var prefermain planiat; run;

*covarying DV order;
proc glm data=motind2R.rep ; class condition dvorder;
model prefermain=condition|dvorder; run;

proc glm data=motind2R.rep ; class condition dvorder;
model planiat=condition|dvorder; run;

ODS HTML CLOSE;




TITLE 'Rep-Dem Average Difference';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Rep-Dem Average Difference.html';
data motind2R.two; set motind2R.all; 
keep = 0; 
if majorparty in ("Dem", "Rep") then keep=1; 
if keep = 0 then delete; run;

proc ttest data=motind2R.two; class majorparty; var prefermain planiat; run;
ODS HTML CLOSE; 




**********************************INDEPENDENTS**************************************;


TITLE 'CIs on main analyses';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\CIs on main analyses.html';

proc glm data=motind2R.ind;
model prefermain=conditionnum|poliat / CLPARM; run;

proc glm data=motind2R.ind; 
model planiat=conditionnum|poliat / CLPARM; run;

proc glm data=motind2R.strong; 
model prefermain=conditionnum|poliat / CLPARM; run;

proc glm data=motind2R.strong; 
model planiat=conditionnum|poliat / CLPARM; run;

proc means data=motind2R.ind; class conditionnum poliatbin; var planiat prefermain; run;

ODS HTML CLOSE; 



TITLE 'Independents - IAT incremental validity WITH CIs';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Independents - IAT incremental validity WITH CIs.html';

proc glm data=motind2R.ind; 
model prefermain=conditionnum partyinfluenced partyforce / CLPARM ; run;

proc glm data=motind2R.ind; 
model prefermain=conditionnum partyinfluenced partyforce poliat / CLPARM ; run;

proc glm data=motind2R.ind; 
model prefermain=conditionnum partyinfluenced partyforce poliat
partyinfluenced*conditionnum partyforce*conditionnum / CLPARM ; run;

proc glm data=motind2R.ind; 
model prefermain=conditionnum partyinfluenced partyforce poliat
partyinfluenced*conditionnum partyforce*conditionnum poliat*conditionnum / CLPARM ; run;

proc glm data=motind2R.ind; 
model planiat=conditionnum partyinfluenced partyforce / CLPARM ; run;

proc glm data=motind2R.ind; 
model planiat=conditionnum partyinfluenced partyforce poliat / CLPARM ; run;

proc glm data=motind2R.ind; 
model planiat=conditionnum partyinfluenced partyforce poliat
partyinfluenced*conditionnum partyforce*conditionnum / CLPARM ; run;

proc glm data=motind2R.ind; 
model planiat=conditionnum partyinfluenced partyforce poliat
partyinfluenced*conditionnum partyforce*conditionnum poliat*conditionnum / CLPARM ; run;

ODS HTML CLOSE;



TITLE 'Independents - IAT incremental validity WITH CIs WITH political ideology';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Independents - IAT incremental validity WITH CIs WITH political ideology.html';

proc glm data=motind2R.ind; 
model prefermain=conditionnum partyinfluenced partyforce politics / CLPARM ; run;

proc glm data=motind2R.ind; 
model prefermain=conditionnum partyinfluenced partyforce politics poliat / CLPARM ; run;

proc glm data=motind2R.ind; 
model prefermain=conditionnum partyinfluenced partyforce politics poliat
partyinfluenced*conditionnum partyforce*conditionnum politics*conditionnum / CLPARM ; run;

proc glm data=motind2R.ind; 
model prefermain=conditionnum partyinfluenced partyforce politics poliat
partyinfluenced*conditionnum partyforce*conditionnum politics*conditionnum poliat*conditionnum / CLPARM ; run;

proc glm data=motind2R.ind; 
model planiat=conditionnum partyinfluenced partyforce politics / CLPARM ; run;

proc glm data=motind2R.ind; 
model planiat=conditionnum partyinfluenced partyforce politics poliat / CLPARM ; run;

proc glm data=motind2R.ind; 
model planiat=conditionnum partyinfluenced partyforce politics poliat
partyinfluenced*conditionnum partyforce*conditionnum politics*conditionnum / CLPARM ; run;

proc glm data=motind2R.ind; 
model planiat=conditionnum partyinfluenced partyforce politics poliat
partyinfluenced*conditionnum partyforce*conditionnum politics*conditionnum poliat*conditionnum / CLPARM ; run;

ODS HTML CLOSE;


************graphing the interaction ------- REDO GRAPHS IF NEED TO OLD ONES NEED TO BE UPDATED AXES**************************;
filename grafout 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R'; 
goptions gsfname=grafout gsfmode=replace NOFILEONLY rotate=landscape device=sasemf target=sasemf 
	gunit=pt ftext="Arial" ftitle="Arial" htext=20pt  gsfmode=replace hsize=9in vsize=6in;
goptions reset=axis;

TITLE1 "Independents IAT DV";
AXIS1 LABEL=(ANGLE=90 ROTATE=0 "Implicit Mainstream Preference")    MINOR=(n=1)  
order=-.6 to .95 by .25;
AXIS2 LABEL=("Implicit Party Identification") minor=none order=-.85 to 1.05 by .3;
legend1 label=(h=16pt j=r "Party Proposed Mainstream" position=top) shape=line(60pt) mode=share
position=(bottom right inside) across=1 
value=( h=12pt j=l "Dems Proposed Mainstream" "Reps Proposed Mainstream");
SYMBOL1 INTERPOL=R C=black line=1 mode=include w=5;
SYMBOL2 INTERPOL=R C=black line=2 mode=include w=5;
PROC GPLOT DATA=motind2R.ind; 
	PLOT	planiat*poliat=condition / noframe vaxis=axis1 haxis=axis2 legend=legend1; RUN;QUIT;

TITLE1 "Independents Explicit DV";
AXIS1 LABEL=(ANGLE=90 ROTATE=0 "Explicit Mainstream Preference")    MINOR=(n=1)  
order=-3.5 to 4.05 by 1.25;
AXIS2 LABEL=("Implicit Party Identification") minor=none order=-.85 to 1.05 by .3;
legend1 label=(h=16pt j=r "Party Proposed Mainstream" position=top) shape=line(60pt) mode=share
position=(bottom right inside) across=1 
value=( h=12pt j=l "Dems Proposed Mainstream" "Reps Proposed Mainstream");
SYMBOL1 INTERPOL=R C=black line=1 mode=include w=5;
SYMBOL2 INTERPOL=R C=black line=2 mode=include w=5;
PROC GPLOT DATA=motind2R.ind;
	PLOT	prefermain*poliat=condition / noframe vaxis=axis1 haxis=axis2 legend=legend1; RUN;QUIT;

TITLE1 "Independents Explicit DV - Party Force IV";
AXIS1 LABEL=(ANGLE=90 ROTATE=0 "Explicit Mainstream Preference")    MINOR=(n=1)  
order=1 to 7 by 1;
AXIS2 LABEL=("Forced Party Identification") minor=none order= -3 to 3 by 1;
legend1 label=(h=16pt j=r "Party Proposed Mainstream" position=top) shape=line(60pt) mode=share
position=(bottom right inside) across=1 
value=( h=12pt j=l "Dems Proposed Mainstream" "Reps Proposed Mainstream");
SYMBOL1 INTERPOL=R C=black line=1 mode=include w=5;
SYMBOL2 INTERPOL=R C=black line=2 mode=include w=5;
PROC GPLOT data=motind2R.ind;  
	PLOT	prefermain*partyforce=condition / noframe vaxis=axis1 haxis=axis2 legend=legend1; RUN;QUIT;

TITLE1 "Independents IAT DV - Party Force IV";
AXIS1 LABEL=(ANGLE=90 ROTATE=0 "Implicit Mainstream Preference")    MINOR=(n=1)  
order=-.6 to .6 by .2;
AXIS2 LABEL=("Forced Party Identification") minor=none order= -3 to 3 by 1;
legend1 label=(h=16pt j=r "Party Proposed Mainstream" position=top) shape=line(60pt) mode=share
position=(bottom right inside) across=1 
value=( h=12pt j=l "Dems Proposed Mainstream" "Reps Proposed Mainstream");
SYMBOL1 INTERPOL=R C=black line=1 mode=include w=5;
SYMBOL2 INTERPOL=R C=black line=2 mode=include w=5;
PROC GPLOT data=motind2R.ind;  
	PLOT	planiat*partyforce=condition / noframe vaxis=axis1 haxis=axis2 legend=legend1; RUN;QUIT;



**************************Strong Independents***********************************;


TITLE1 "Strong Independents IAT DV";
AXIS1 LABEL=(ANGLE=90 ROTATE=0 "Implicit Mainstream Preference")    MINOR=(n=1)  
order=-.6 to .6 by .2;
AXIS2 LABEL=("Implicit Party Identification") minor=none order=-.6 to .6 by .2;
legend1 label=(h=16pt j=r "Party Proposed Mainstream" position=top) shape=line(60pt) mode=share
position=(bottom right inside) across=1 
value=( h=12pt j=l "Dems Proposed Mainstream" "Reps Proposed Mainstream");
SYMBOL1 INTERPOL=R C=black line=1 mode=include w=5;
SYMBOL2 INTERPOL=R C=black line=2 mode=include w=5;
PROC GPLOT DATA=motind2R.strong; 
	PLOT	planiat*poliat=condition / noframe vaxis=axis1 haxis=axis2 legend=legend1; RUN;QUIT;

TITLE1 "Strong Independents Explicit DV";
AXIS1 LABEL=(ANGLE=90 ROTATE=0 "Explicit Mainstream Preference")    MINOR=(n=1)  
order=1 to 7 by 1;
AXIS2 LABEL=("Implicit Party Identification") minor=none order=-.6 to .6 by .2;
legend1 label=(h=16pt j=r "Party Proposed Mainstream" position=top) shape=line(60pt) mode=share
position=(bottom right inside) across=1 
value=( h=12pt j=l "Dems Proposed Mainstream" "Reps Proposed Mainstream");
SYMBOL1 INTERPOL=R C=black line=1 mode=include w=5;
SYMBOL2 INTERPOL=R C=black line=2 mode=include w=5;
PROC GPLOT DATA=motind2R.strong;
	PLOT	prefermain*poliat=condition / noframe vaxis=axis1 haxis=axis2 legend=legend1; RUN;QUIT;




TITLE 'Full Sample - IAT incremental validity';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Full Sample - IAT incremental validity.html';

data motind2R.major; set motind2R.all; 
keep = 0; 
if majorparty in ("Dem", "Rep", "Ind") then keep=1; 
if keep = 0 then delete; run;

data motind2R.major; set motind2R.major; 
informat newparty 1.; 
newparty = .; 
if majorparty = "Rep" then newparty = -2; 

if majorparty = "Ind" then do; 
if indforce = "RepInd" then newparty = -1; 
else if indforce = "StrongInd" then newparty = 0; 
else if indforce = "DemInd" then newparty = 1; end; 

else if majorparty = "Dem" then newparty = 2; run;

proc freq data=motind2R.major; table newparty; run;
proc sort data=motind2R.major; by newparty; 
proc freq data=motind2R.major; by newparty; 
tables majorparty indforce; run;

proc glm data=motind2R.major; 
model prefermain=conditionnum partyinfluenced newparty; run;

proc glm data=motind2R.major; 
model prefermain=conditionnum partyinfluenced newparty poliat; run;

proc glm data=motind2R.major; 
model prefermain=conditionnum partyinfluenced newparty poliat
partyinfluenced*conditionnum newparty*conditionnum; run;

proc glm data=motind2R.major; 
model prefermain=conditionnum partyinfluenced newparty poliat
partyinfluenced*conditionnum newparty*conditionnum poliat*conditionnum; run;

proc glm data=motind2R.major; 
model planiat=conditionnum partyinfluenced newparty; run;

proc glm data=motind2R.major; 
model planiat=conditionnum partyinfluenced newparty poliat; run;

proc glm data=motind2R.major; 
model planiat=conditionnum partyinfluenced newparty poliat
partyinfluenced*conditionnum newparty*conditionnum; run;

proc glm data=motind2R.major; 
model planiat=conditionnum partyinfluenced newparty poliat
partyinfluenced*conditionnum newparty*conditionnum poliat*conditionnum; run;

ODS HTML CLOSE; 


TITLE 'Awareness';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Awareness.html';

proc sort data=motind2R.all; by majorparty; 
proc means data=motind2R.all n mean std; by majorparty; class condition aware; var prefermain planiat; run;

proc glm data=motind2R.ind; 
model prefermain=conditionnum|poliat|aware / CLPARM; run;

proc glm data=motind2R.ind; 
model planiat=conditionnum|poliat|aware / CLPARM; run;

proc glm data=motind2R.dem; 
model prefermain=conditionnum|poliat|aware / CLPARM; run;

proc glm data=motind2R.dem; 
model planiat=conditionnum|poliat|aware / CLPARM; run;

proc glm data=motind2R.rep; 
model prefermain=conditionnum|poliat|aware / CLPARM; run;

proc glm data=motind2R.rep; 
model planiat=conditionnum|poliat|aware / CLPARM; run;

ODS HTML CLOSE; 


TITLE 'Main Analysis with IMC Failures Removed';
ODS HTML BODY = 'C:\Users\Carlee\Documents\Research Projects\Moderates\motivatedindependents2\analysis\motind2R\Main Analysis with IMC Failures Removed.html';

data motind2R.IMC; set motind2R.all;
if IMC = 0 then delete; run;
*deleted 628;

proc freq data=motind2R.IMC; table IMC; run; 

proc sort data=motind2R.IMC; by majorparty; 

proc ttest data=motind2R.IMC; by majorparty; 
class condition; var prefermain planiat; run;

proc glm data=motind2R.IMC (where=(majorparty="Ind")); 
class condition;
model prefermain=condition|poliat; run;

proc glm data=motind2R.IMC (where=(majorparty="Ind")); 
class condition;
model planiat=condition|poliat; run;

proc glm data=motind2R.IMC (where=(indforce="StrongInd")); 
class condition;
model prefermain=condition|poliat; run;

proc glm data=motind2R.IMC (where=(indforce="StrongInd")); 
class condition;
model planiat=condition|poliat; run;

proc sort data=motind2R.IMC; by majorparty; 

proc means data=motind2R.IMC ; by majorparty; 
class poliatbin condition; 
var planiat prefermain; run;

ODS HTML CLOSE;



*removing selected demographics that could possibly be identifying for posting data;
data motind2R.post; set motind2R.all; 
drop byear bmonth dayofbirth characteristic genoccupation major reldenom  relfamily religion work  zip; run;
